User loginNavigation |
Comparing Approaches to Generic Programming in Haskell
Comparing Approaches to Generic Programming in Haskell
by Ralf Hinze, Johan Jeuring, and Andres Löh. 2006.
You just started implementing your third web shop in Haskell, and you realize that a lot of the code you have to write is similar to the code for the previous web shops. Only the data types have changed. Unfortunately, this implies that all reporting, editing, storing and loading in the database functionality, and probably a lot more, has to be changed. You’ve heard about generic programming, a technique which can be used to automatically generate programs depending on types. But searching on the web gives you almost ten approaches to solve your problem: DrIFT, PolyP, Generic Haskell, Derivable Type Classes, Template Haskell, Scrap Your Boilerplate, Generics for the Masses, Strafunski, etc. How do you choose? And these are only the approaches to generic programming in Haskell. If you are also flexible in the programming language you use, there is a much larger variety of different approaches to generic programming to choose from.[on edit: updated link to point to a more complete version of the paper] Misc itemsA couple of items I came across, that might be of some interest.
Extending Prolog with Incomplete Fuzzy InformationExtending Prolog with Incomplete Fuzzy Information. Susana Munoz-Hernandez, Claudio Vaucheret. 2005.
A project of related interest is Fril which as far as I remember wasn't discussed here. Bit Stream Programing in ErlangSince 2001, the functional language Erlang comes with a byte-oriented datatype (called binary) and with constructs to do pattern matching on a binary. We have been heavily involved in this work and implemented a scheme for native code compilation of binaries and designed efficient algorithms for constructing deterministic pattern matching automata for byte-based binaries. In last year's Erlang workshop we put forward a proposal for lifting the restriction that Erlang binaries are sequences of bytes rather than bits and described the semantics of bit-level pattern matching on a bit-level binary (called bit stream). We have subsequently realized this proposal and describe its applications and implementation in this paper.Be sure to see the benchmarks on page 13 comparing Erlang, Haskell, Objective Caml, C, and Java for processing binary data. Having used the existing binary pattern matching support in Erlang, I'm looking forward to the official language support for bit streams. The Role of Composition in Computer ProgrammingThis paper by Donald McIntyre is a classic in the J language world. It ranks up there with "Why Functional Programming Matters" in terms of concise, impressive examples. Most of the examples have a geometric bent, like finding the area of a polygon. Note that this paper was written using an early version of J, so some of the syntax has unfortunately changed. Teaching Discrete Mathematics via Primary Historical Sources(via LogBlog)
This sort of apporach is very close to my heart, as LtU readers probably know. I wish them well. By Ehud Lamm at 2006-12-18 20:46 | History | Teaching & Learning | 11 comments | other blogs | 9773 reads
Elements of InteractionRobin Milner's 1991 Turing Award Lecture describing CCS (Calculus for Communicating Systems) and pi-calculus. An Axiomatic Basis for Computer ProgrammingAn Axiomatic Basis for Computer Programming by Tony Hoare, 1969.
Considered by many to be among the best of the great works in programming languages. By Luke Gorrie at 2006-12-16 21:49 | Semantics | login or register to post comments | other blogs | 26907 reads
Practical Type Inference Based on Success TypingsWe show that it is possible to reconstruct a significant portion of the type information which is implicit in a program, automatically annotate function interfaces, and detect definite type clashes without fundamental changes to the philosophy of the language or imposing a type system which unnecessarily rejects perfectly reasonable programs. To do so, we introduce the notion of success typings of functions. Unlike most static type systems, success typings incorporate subtyping and never disallow a use of a function that will not result in a type clash during runtime. Unlike most soft typing systems that have previously been proposed, success typings allow for compositional, bottom-up type inference which appears to scale well in practice.A recent paper using a subset of Erlang for the examples. This continues the trend of methods for uncovering type errors in dynamically-typed Erlang. One such tool, Dialyzer, is now part of the Erlang distribution. Java Open Review Project
This may be an easy way to get a glimpse at what static analysis tools can do. Reviewing the potential defects identified by the automatic tools is a good starting point for thinking about the implications of various decisions about language semantics, and about language expressiveness in general. To see actual code, you need to login using the guest account details provided on the page. |
Browse archives
Active forum topics |
Recent comments
2 weeks 3 days ago
2 weeks 4 days ago
2 weeks 6 days ago
2 weeks 6 days ago
3 weeks 4 days ago
3 weeks 4 days ago
3 weeks 4 days ago
6 weeks 4 days ago
7 weeks 3 days ago
7 weeks 3 days ago